@svizzle/utils/[any-array]-[any-array]

Methods

(static) makeBiPermutationsWith(accessor) → {function}

Source:
Since:
  • 0.5.0

Return a function returning the pair-permutations of the items returned by the provided accessor.

Example
> object = {
  key: 'foobars',
  value: [
    {foo: 'a'},
    {foo: 'b'},
    {bar: 'c'},
    {bar: 'd'}
  ]
}
> makeBiPermutations = makeBiPermutationsWith(getValue)
[
  [{foo: 'a'}, {foo: 'b'}],
  [{foo: 'a'}, {bar: 'c'}],
  [{foo: 'a'}, {bar: 'd'}],
  [{foo: 'b'}, {bar: 'c'}],
  [{foo: 'b'}, {bar: 'd'}],
  [{bar: 'c'}, {bar: 'd'}]
]
Parameters:
Name Type Description
accessor function
Returns:
  • (Any -> Array)
Type
function